
const Pool = require("../../mysql/index");

class OrdersDao {
  async insert(orderId , bookId , count) {
    let sql = `INSERT INTO orders VALUES(${orderId},${bookId},${count})`
    console.log(sql)
    await Pool.query(sql).finally(() => {
      Pool.end();
    })
  }
  async getBookByorderId(orderId) {
    let sql = `SELECT book.* FROM orders,book WHERE book.id=orders.bookId AND orders.orderId = ${orderId}`
    console.log(sql)
    return await Pool.query(sql);
  }
}

module.exports = new OrdersDao();